<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta content="webkit" name="renderer">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"
          name="viewport">
    <link rel="stylesheet" href="/asset/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header"></div>
                <div class="layui-card-body">

                    <!--顶部搜索框 start-->
                    <div class="layui-form">
                        <div class="layui-inline">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-block">
                                <input type="text" placeholder="请输入" autocomplete="off" class="layui-input" name='createBy' data-search="true">
                            </div>
                        </div>
                    </div>
                    <!--顶部搜索框 end-->

                    <!--顶部按钮-->
                    <div style="padding:10px;text-align: center">
                        <button class="layui-btn layui-btn-radius" data-type="search">
                            <i class="layui-icon layui-icon-search "></i>搜索
                        </button>
                        <button class="layui-btn layui-btn-radius layui-btn-warm" data-type="clear">
                            <i class="layui-icon layui-icon-close "></i>清空
                        </button>
                        <button class="layui-btn layui-btn-radius layui-btn-danger" data-type="delAll">
                            <i class="layui-icon layui-icon-delete "></i>批量删除
                        </button>
                    </div>

                    <!--表格主体-->
                    <table id="table" lay-filter="table"></table>

                    <!--表格行基本操作模板-->
                    <script type="text/html" id="operation">
                        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete">删除</i></a>
                    </script>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/asset/layui/layui.js"></script>
<script src="/my/fast.js"></script>
<script>
    layui.use(() => {
        let $ = layui.$
        let table = layui.table;

        // 接口地址
        let page = UPMS_ADDRESS + '/sysLog/page';
        let del = UPMS_ADDRESS + '/sysLog/delete';
        let toSaveOrUpdate = '';

        table.render({
            elem: 'table'
            , url: page
            , method: 'post'
            , height: 'full-190'
            , cellMinWidth: 120
            , cols: [[
                {type: 'numbers'}
                , {type: 'checkbox'}
                , {field: 'id', title: 'ID', align: 'center', sort: true, hide: true}
                , {field: 'createBy', title: '用户名', align: 'center', sort: true}
                , {field: 'ip', title: 'ip', align: 'center', sort: true}
                , {field: 'cname', title: '城市', align: 'center', sort: true}
                , {field: 'device', title: '设备', align: 'center', sort: true}
                , {field: 'platform', title: '系统', align: 'center', sort: true}
                , {field: 'networkType', title: '网络', align: 'center', sort: true}
                , {field: 'createTime', title: '时间', align: 'center', sort: true}
                , {title: '操作', align: 'center', toolbar: '#operation'}
            ]]
            , page: true
            , toolbar: true
            , parseData: rs => { // 将原始数据解析成 table 组件所规定的数据
                return {
                    "code": rs.code,
                    "msg": rs.msg,
                    "count": rs.data.total,
                    "data": rs.data.records
                }
            }
            , response: {
                statusCode: 200 // 重新设定成功状态码，默认：0
            }
            , request: { // 重新设定分页参数
                pageName: 'current' // 页码参数名，默认：page
                , limitName: 'size' // 每页显示条数参数名，默认：limit
            }
            , even: true // 开启隔行背景
            , escape: true // 开启 xss 字符过滤
        });

        // layui--基础操作
        layuiBase($, table, 'table', 'table', $('[data-search=true]'), del, toSaveOrUpdate, obj => {

        });
    });
</script>
</body>
</html>
